package com.jiyun.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jiyun.mapper.RiderQueueMapper;
import com.jiyun.pojo.RiderQueue;
import com.jiyun.pojo.SafetyAssess;
import com.jiyun.service.IRiderQueueService;
import com.jiyun.utils.R;
import com.jiyun.utils.Result;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.ResponseUtil;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-27
 */
@RestController
@RequestMapping("/riderQueue")
@Slf4j
public class RiderQueueController {
    @Autowired
    private IRiderQueueService riderQueueService;
    @Autowired
    private RiderQueueMapper riderQueueMapper;
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("findAll")
    public List<RiderQueue> findAll(Integer id) {
        return riderQueueService.findAll(id);
    }

    @RequestMapping("findAll2")
    public List<RiderQueue> findAll2(Integer did, Integer id) {
        return riderQueueService.findAll2(did, id);
    }

    @RequestMapping("updateDriverId")
    public void updateDriverId(Integer id, Integer did) {
        riderQueueService.updateDriverId(id, did);
    }

    @RequestMapping("updateOrderType")
    public void updateOrderType(Integer id) {
        riderQueueService.updateOrderType(id);
    }

    @RequestMapping("findAll3")
    public List<RiderQueue> findAll3(Integer id) {
        return riderQueueService.findAll3(id);
    }

    @RequestMapping("updateStatus")
    public void updateStatus(Integer id) {
        riderQueueService.updateStatus(id);
    }

    @RequestMapping("updateStatus2")
    public void updateStatus2(Integer id) {
        riderQueueService.updateStatus2(id);
    }

    @RequestMapping("getOne")
    public void getOneType(Integer did, Integer id) {
        riderQueueService.getOneType(did, id);
    }

    @RequestMapping("getTwo")
    public void getTwoType(Integer did, Integer id) {
        riderQueueService.getTwoType(did, id);
    }

    @RequestMapping("getThree")
    public void getThreeType(Integer did, Integer id) {
        riderQueueService.getThreeType(did, id);
    }

    @RequestMapping("getList")
    public BigDecimal getList(Integer did, Integer id) {
        return riderQueueService.getList(did, id);
    }

    @RequestMapping("driverAddress")
    public void driverAddress(String id, String driverLon, String driverLat) {
        riderQueueService.driverAddress(id, driverLon, driverLat);
    }

    @RequestMapping("saveFees")
    public void saveFees(BigDecimal highwayFee, BigDecimal roadBridgeFee, BigDecimal parkingFee, BigDecimal additionalFee, Integer id) {
        riderQueueService.saveFees(highwayFee, roadBridgeFee, parkingFee, additionalFee, id);
    }

    @GetMapping("/priceage")
    public List<RiderQueue> priceage(Integer id) {
        return riderQueueService.findOne(id);
    }


    @GetMapping("/findList")
    public List<RiderQueue> findList() {
        return riderQueueMapper.selectList(null);
    }

    @GetMapping("/findStatus")
    public List<RiderQueue> findStatus(@RequestParam("status") Integer status) {
        System.out.println("status = " + status);
        List<RiderQueue> list = riderQueueService.findStatus(status);
        return list;
    }
    @RequestMapping("findOrderNumber")
    public String findOrderNumber(Integer id){
        return riderQueueService.findOrderNumber(id);
    }

    @RequestMapping("getDriverSumPrive")
    public BigDecimal getDriverSumPrive(Integer did){
        return riderQueueService.getDriverSumPrive(did);
    }


}
